home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime for java / compositedeffects / src / javatext.java < prev   
Encoding:
Java Source  |  2000-09-28  |  1.2 KB  |  41 lines

  1. /*
  2.  * QuickTime for Java SDK Sample Code
  3.  
  4.    Usage subject to restrictions in SDK License Agreement
  5.  * Copyright: © 1996-1999 Apple Computer, Inc.
  6.  
  7.  */
  8. import java.awt.*;
  9. import quicktime.app.image.*;
  10.  
  11. class JavaText implements Paintable {
  12.     Font font = new Font ("Helvetica", Font.PLAIN, 24);
  13.     int width, height;
  14.     Rectangle[] r = new Rectangle[1];
  15.     
  16.     public void newSizeNotified (QTImageDrawer drawer, Dimension d) {
  17.         width = d.width;
  18.         height = d.height;
  19.         r[0] = new Rectangle (width, height);
  20.     }
  21.     
  22.     /**
  23.      * Paint on the graphics. The supplied component is the component from which
  24.      * the graphics object was derived or related to and is also the component
  25.      * that is the object that paint was called upon that has called this method.
  26.      * The Graphics object is what you should paint on.
  27.      * This maybe an on or off screen graphics.
  28.      * You should not cache this graphics object as it can be different
  29.      * between different calls.
  30.      * @param comp the component from which the Graphics object was derived or 
  31.      * related too.
  32.      * @param g the graphics to paint on.
  33.      */
  34.     public Rectangle[] paint (Graphics g) {        
  35.         g.setColor (Color.magenta);
  36.         g.setFont (font);
  37.         g.drawString ("Java Text", 2, 20);
  38.         return r;
  39.     }
  40. }
  41.